import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import api from './api';

process.on('uncaughtException', function (e) {
  /*处理异常*/
  console.log(e.message);
});

const app = express();

app.use(cors());
app.use(bodyParser.json());

Object.keys(api).forEach((key: string) => {
  app.use('/api', (api as any)[key]);
});

app.listen(8080, () => {
  console.log('http://127.0.0.1:8080');
});
